package com.caishi.lkx.exam.ienum.type;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.caishi.lkx.exam.ienum.BaseEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.zzw.common.mysql.MybatisPlusEnum;
import lombok.Getter;

/**
 * @author by Janisa
 * @Description:
 * @date 2022/2/8 20:07
 */
public enum QuestionSourceType implements MybatisPlusEnum<Integer>, BaseEnum<Integer> {
    // 来源类型（1手动录入 2word导入 3vers6.0同步 4才士题库同步 5 组合题）
    importHand("手动录入", 1),
    inputForA("word导入", 2),
    inputForB("vers6.0同步", 3),
    inputForC("才士题库同步", 4),
    combination("组合题", 5),
    ;

    @Getter
    final
    String desc;

    @Getter
    @JsonValue
    @EnumValue
    final
    Integer code;

    QuestionSourceType(String desc, Integer code) {
        this.desc = desc;
        this.code = code;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @JsonCreator
    public static QuestionSourceType fromCode(Integer code) {
        return BaseEnum.fromCode(QuestionSourceType.class, code);
    }
}
